package yxy.cherry.paycenter.channelmodule.yxy;

import java.util.ArrayList;
import org.joda.time.DateTime;

import com.alibaba.fastjson.JSONObject;
import yxy.apple.logger.Logger;
import yxy.cherry.data.bean.charge;
import yxy.cherry.paycenter.channelmodule.PayMoudle_channel;
import yxy.cherry.paycenter.database.db.orders;
import yxy.game.pm2.bean.Currency;
import yxy.game.pm2.bean.channel.SdkChannel;
import yxy.game.pm2.bean.module.OrderInfoModule;
import yxy.game.pm2.bean.order.OrderInfo;

/**
 * ya 假支付
 * @author Dell
 *
 */
public class PayMoudle_yxy extends PayMoudle_channel{

	static final Logger logger = Logger.create(PayMoudle_yxy.class);

//	private static final String channel = SdkChannel.yxy;
	
	@Override
	public JSONObject dealPay(JSONObject infoobj) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public JSONObject createOrderInfo(JSONObject infoobj, orders o) {
		JSONObject json = new JSONObject();
		json.put("goodsid", o.getGoodsid());
		json.put("goodsprice", o.getGoodsprice());
		json.put("myorderid", o.getMyorderid());
		json.put("playercode", o.getPlayercode());
		json.put("sid", o.getServerid());
		json.put("acttype", o.getActtype());
		return json;
	}

	@Override
	public String getChannel() {
		return SdkChannel.sdk_yxy;
	}
	
	public orders createOrderYA(int dataid, String playercode, int serverid, int acttype) {
		orders o = createOrder(getChannel(), dataid, acttype, playercode, serverid);
		o.setSubchannel(getChannel());
		addOrder(o);
		return o;
	}
	
	/**
	 * 创建 OrderInfo
	 * @param o
	 * @param curs
	 * @param c
	 * @param payamount
	 */
	public void createOrderInfoModule(orders o, ArrayList<Currency> curs, charge c, int payamount) {
		createOrderInfoModule(o, curs, c.getVipexp(), payamount);
	}
	
	/**
	 * 
	 * @param o
	 * @param curs
	 * @param vipexp
	 * @return
	 */
	public void createOrderInfoModule(orders o, ArrayList<Currency> curs, int vipexp, int payamount) {
		OrderInfo oi = OrderInfoModule.createOrderInfo(o.getGoodsid(), o.getChannel(), o.getMyorderid(), new DateTime(o.getCreatetime().getTime()), 
				OrderInfoModule.orderinforuning, o.getPlatorderid(), o.getActtype(), o.getPlayercode(), curs, 
				o.getServerid(), DateTime.now(), vipexp, payamount, o.getGoodsprice());
		OrderInfo.set(o.getPlayercode(), oi);
	}
	

//	public static void main(String[] args) {
////		String date = new SimpleDateFormat("yyyyMMdd").format(new Date());
////		String seconds = new SimpleDateFormat("HHmmss").format(new Date());
////
////		System.out.println(System.currentTimeMillis() + "-------" + getRandomOfSize(1) + "--------");
////		System.out.println(System.currentTimeMillis() + "-------" + getRandomOfSize(2) + "--------");
////		System.out.println(System.currentTimeMillis() + "-------" + getRandomOfSize(3) + "--------");
////		System.out.println(System.currentTimeMillis() + "-------" + getRandomOfSize(4) + "--------");
////		System.out.println(System.currentTimeMillis() + "-------" + getRandomOfSize(5) + "--------");
////		System.out.println(System.currentTimeMillis() + "-------" + getRandomOfSize(6) + "--------");
////		
//////		20200927	000		03	000	155441	84
////		System.out.println(date+"000"+getRandomOfSize(3)+"000"+seconds+getRandomOfSize(3));
////		
//		
//		
//		String str = "{\r\n" + 
//				"    \"circleTime\": 2484172800000,\r\n" + 
//				"    \"endTime\": \"2099-01-01T23:59:59.624+08:00\",\r\n" + 
//				"    \"round\": 0,\r\n" + 
//				"    \"startTime\": \"2020-04-13T23:59:59.624+08:00\"\r\n" + 
//				"  }";
//		JSONObject json = new JSONObject();
//		json = JSON.parseObject(str);
//		String ext = createExt(json);
//		System.out.println(ext);
//		System.out.println(analysisExt(ext));
////		System.out.println("|" + new PayMoudle_yxy().getUrl() + "|");
//
//	}


}
